#include <iostream>
#include <cstring>
#include <algorithm>
#include <map>
#include <vector>
#define int long long
#define x first
#define y second
using namespace std;
const int N = 2e5 + 10;
int n;
vector<int> G[N];
int ans[N];
void solve()
{
    cin >> n;
    for(int i = 1; i < n; i++) 
    {
        int u,v;
        cin >> u >> v;
        G[u].push_back(v);
        G[v].push_back(u);
    }
    for(int i = 1; i <= n; i++)
    {
        int t = 0;
        for(int v : G[i]) t += G[v].size() - 1; 
        cout << t  << " ";  
    }
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr),cout.tie(nullptr);
    int t = 1;
    /* cin >> t; */
    while(t -- )  solve();
    return 0;
}